  
package com.xebest.web.service.impl;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.xebest.common.enums.erp.order.*;
import com.xebest.constant.XeConstans;
import com.xebest.util.OrderBeanUtils;
import com.xebest.web.mapper.read.XeVenOrderReadMapper;
import com.xebest.web.mapper.read.XeVenStoreInfoReadMapper;
import com.xebest.web.mapper.write.XeVenOrderWriteMapper;
import com.xebest.web.model.*;
import com.xebest.web.service.XeVenOrderService;
import com.xebest.web.service.XeVenOrderSyncOrderService;
import com.xebest.web.service.XeVenStoreInventoryService;
import com.xebest.web.view.ErpUserInfo;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;
import java.util.*;

/**
 * 订单同步接口
 * @desc: xebest-erp  
 * @author: 李贝贝  
 * @createTime: 2017年8月10日 下午1:56:26  
 * @history:  
 * @version: v1.0
 */
@Service
public class XeVenOrderSyncOrderServiceImpl implements XeVenOrderSyncOrderService {
	private static Logger log = LoggerFactory.getLogger(XeVenOrderSyncOrderServiceImpl.class);//日志记录
	
	@Autowired
	private XeVenOrderWriteMapper xeVenOrderWriteMapper; //更新订单业务操作
	
	@Autowired
	private XeVenOrderReadMapper xeVenOrderReadMapper;//查询订单业务
	
	@Autowired
	private XeVenStoreInventoryService xeVenStoreInventoryService;//库存一览操作
	
	@Autowired
	private XeVenStoreInfoReadMapper xeVenStoreInfoReadMapper;//查询仓库操作
	
	@Autowired
	private XeVenOrderService xeVenOrderService;//订单业务
	
	/**
	 * 鲜易云ERP订单同步接口批量
	 * @author: 李贝贝
	 * @createTime: 2017年6月28日 上午10:40:17  
	 * @history:  
	 * @param orderEntity
	 * @return
	 * @throws Exception int
	 */
	@Transactional(value="writeTransactionManager")
	public int insertXeVenOrderBatch(List<XeVenOrderInfoEntity> orderList) throws Exception{
		int result = 0 ;
		/*"规则：
		1、 众品八家询报价订单不用分仓。直接保存
		2、 其它订单进行分仓。
		3、 根据订单商户编码、订单收货地址省市区三级进行逆向查找仓库，如果找到仓库，则判断订单库存商品是否充足，充足分仓。只要有订单商品库存不足则判断是否允许负库存，允许则分仓，如果不存在商品，则订单置为异常订单。
		"在线支付订单待付款的不用分仓 直接保存
		*/
		List<XeVenOrderInfoEntity> saveOrderList = new ArrayList<XeVenOrderInfoEntity>();
		for (XeVenOrderInfoEntity orderEntity : orderList) {
			if (VenOrderZpEnum.YES.getValue() == orderEntity.getZpOrder()) {
				//1、 众品八家询报价订单不用分仓,直接保存
				result += this.saveOrder(orderEntity) ;
				continue ;
			}else if (VenOrderPayTypeEnum.ONLINE_PAY.getValue() == orderEntity.getPayType() 
					/*&& VenOrderPayStatusEnum.UNPAID.getValue() == orderEntity.getPayStatus()*/) {
				//在线支付订单待付款的不用分仓 直接保存
				orderEntity.setOrderStatus(VenOrderStatusEnum.WAIT_DIS.getValue());//在线支付订单 未支付 待分配仓库
				orderEntity.setPayStatus(VenOrderPayStatusEnum.UNPAID.getValue());//待支付
				result += this.saveOrder(orderEntity) ;
				continue ;
			}else {
				//自动分仓开始
				log.info("分仓开始，订单号{}",orderEntity.getOrderId());
				orderEntity = this.autoSortWareHouse(orderEntity);
				orderEntity.setPayStatus(VenOrderPayStatusEnum.UNPAID.getValue());//待支付
				orderEntity.setZpOrder(1);
				saveOrderList.add(orderEntity);
				log.info("分仓结束，订单号{}",orderEntity.getOrderId());
			}
		}
		if (null != saveOrderList && saveOrderList.size() >0) {
			//开始批量保存订单
			result = this.saveOrderBatch(saveOrderList) ;
		}
		
		return result;
	}
	
	
	/**
	 * 保存订单信息
	 * @author: 李贝贝
	 * @createTime: 2017年8月15日 上午9:44:09  
	 * @history:  
	 * @param orderEntity
	 * @return int
	 */
	private int saveOrder(XeVenOrderInfoEntity orderEntity){
	   List<XeVenOrderInfoDetailEntity> detailTempList = orderEntity.getOrderInfoDetailList();
	   for (XeVenOrderInfoDetailEntity detail : detailTempList) {
		   detail.setCreateDate(orderEntity.getCreateDate());
		   if (null == detail.getInventoryFlag()) {
				detail.setInventoryFlag(1);
			}
	    }
		xeVenOrderWriteMapper.insertBatchXeVenOrderInfoDetail(detailTempList);
		if (null == orderEntity.getPromotOrderType()) {
			orderEntity.setPromotOrderType(3);
		}
	    int  result = xeVenOrderWriteMapper.insertXeVenOrderInfo(orderEntity);
        return result;     
	}
	
	/**
	 * 批量保存订单信息
	 * @author: 李贝贝
	 * @createTime: 2017年8月15日 上午9:44:09  
	 * @history:  
	 * @param orderEntity
	 * @return int
	 */
	private int saveOrderBatch(List<XeVenOrderInfoEntity> orderEntity) throws Exception{
		int result = 0 ;
		List<XeVenOrderInfoDetailEntity> detailList = new ArrayList<XeVenOrderInfoDetailEntity>();
		for (XeVenOrderInfoEntity order : orderEntity) {
			if (null == order.getPromotOrderType()) {
				order.setPromotOrderType(3);
			}
			List<XeVenOrderInfoDetailEntity> detailTempList = order.getOrderInfoDetailList();
			boolean secMark = false;
			for (XeVenOrderInfoDetailEntity detail : detailTempList) {
			    detail.setCreateDate(order.getCreateDate());
				if (null == detail.getInventoryFlag()) {
					detail.setInventoryFlag(1);
				}
			    if (4 == detail.getProType()) {
			    	secMark  =  true ;//订单添加秒杀标识
			    }
			}
			detailList.addAll(detailTempList);
			if (secMark) {
				String orderMark = order.getOrderMark();//订单标记
		    	if (orderMark != null ) {
		    		order.setOrderMark(orderMark+","+VenOrderMarkEnum.SEC.getValue());//订单添加秒杀标识
				}else{
					order.setOrderMark(VenOrderMarkEnum.SEC.getValue());//订单添加秒杀标识
				}
			}
			if (null != order.getCpnsPmtAomount() && order.getCpnsPmtAomount().compareTo(BigDecimal.ZERO)> 0) {
		    	String orderMark = order.getOrderMark();//订单标记
		    	if (orderMark != null ) {
		    		order.setOrderMark(orderMark+","+VenOrderMarkEnum.COUPON.getValue());//订单添加优惠券标识
				}else{
					order.setOrderMark(VenOrderMarkEnum.COUPON.getValue());//订单添加优惠券标识
				}
			}
		}
		xeVenOrderWriteMapper.insertBatchXeVenOrderInfoDetail(detailList);
		log.info("保存订单信息:{}",JSON.toJSONString(orderEntity));
	    result = xeVenOrderWriteMapper.insertXeVenOrderInfoBatch(orderEntity); //批量插入方法
        return result;     
	}
	
	/**
	 * 前台取消/确认收货订单接口
	 * @param orderEntity
	 * @return
	 * @throws Exception
	 */
	@Transactional(value="writeTransactionManager")
	public int updateXeVenOrderInfo(XeVenOrderInfoEntity orderEntity) throws Exception {
		int result = 0;
		for (int i = 0; i < orderEntity.getOrderIdList().size(); i++) {
			orderEntity.setOrderId(orderEntity.getOrderIdList().get(i));
			if (VenOrderStatusEnum.CANCEL.getValue() == orderEntity.getOrderStatus()) {
				Map<String,Object> params = new HashMap<String, Object>();
				params.put("orderId",orderEntity.getOrderIdList().get(i));
				XeVenOrderInfoEntity orderInfo = xeVenOrderReadMapper.getXeVenOrderInfo(params);
				/*if (VenOrderPayTypeEnum.ARRIVE_PAY.getValue() == orderInfo.getPayType()) {
					if (StringUtils.isNotBlank(orderInfo.getStoreId())) {
						XeVenStoreInfoEntity storeInfo = xeVenStoreInfoReadMapper.getStoreInfoByMap(orderInfo.getStoreId(), orderInfo.getUserCode());
						boolean flag = this.xeVenOrderService.fallbackInventory(storeInfo, orderInfo.getOrderInfoDetailList(), orderInfo.getStoreId(), orderInfo.getUserCode(), null);
						if (flag) {
							return result;
						}
					}
				}*/
				orderEntity.setOrderException(VenOrderExpFlagEnum.NO_PROBLEM.getValue());
				if (orderInfo != null && StringUtils.isNotBlank(orderInfo.getOrderMark())) {
					String orderMark = OrderBeanUtils.removeOrderMark(orderInfo.getOrderMark().split(","), VenOrderMarkEnum.EXCEPTIONORDER.getValue());
					orderEntity.setOrderMark(orderMark);
				}
				result = this.xeVenOrderWriteMapper.updateXeVenOrderInfo(orderEntity);
			}
			if (VenOrderStatusEnum.FINISH.getValue() == orderEntity.getOrderStatus()) {
				 result = this.xeVenOrderWriteMapper.updateXeVenOrderInfo(orderEntity);
				if (result == XeConstans._XE_ONE) {
					XeVenOrderLogistics venOrderLogistics = new XeVenOrderLogistics();
					venOrderLogistics.setOrderId(orderEntity.getOrderId());
					venOrderLogistics.setLogtsStatus(VenOrderLogisticsEnum.SIGN.getValue());
					this.xeVenOrderService.updateOrderLogistics(venOrderLogistics, null);
				}
			}
		}
		return result;
	}
	/**
	 * 待付款订单支付状态同步接口
	 * @author: 李贝贝
	 * @createTime: 2017年8月16日 上午11:06:52  
	 * @history:  
	 * @param orderEntity
	 * @return
	 * @throws Exception int
	 */
	@Transactional(value="writeTransactionManager")
	public int updatePayOrder(XeVenOrderInfoEntity orderEntity) throws Exception{
		int  upResult = 0;
		 String userCode = orderEntity.getUserCode();//商户编码
		 String orderId = orderEntity.getOrderId();//订单号
		 String payNum = orderEntity.getPayNumber();//支付单号
		 Date   date = orderEntity.getPayTime();//支付时间
		 //自动分仓开始
		 log.info("分仓开始，订单号{}",orderEntity.getOrderId());
		 XeVenOrderInfoEntity paramOrder  = this.autoSortWareHouse(orderEntity);
		 log.info("分仓结束，订单号{}",orderEntity.getOrderId()); 	
		 //1、更新订单明细库存标识
		 List<XeVenOrderInfoDetailEntity> detailList = paramOrder.getOrderInfoDetailList();
		 boolean secMark = false;
		 for (XeVenOrderInfoDetailEntity detail : detailList) {
			if (detail.getInventoryFlag() == 2) {
				XeVenOrderInfoDetailEntity paramDetail = new XeVenOrderInfoDetailEntity();
				paramDetail.setOrderId(orderId);
				paramDetail.setProSku(detail.getProSku());
				paramDetail.setInventoryFlag(detail.getInventoryFlag());
				int result = xeVenOrderWriteMapper.updateXeVenOrderInfoDetail(paramDetail);
				log.info("更新订单号{},商品sku{}缺货,执行{}",orderId,detail.getProSku(),result);
			}
			 if (4 == detail.getProType()) {
				secMark = true;//订单添加秒杀标识
			  }
		 }
		 //2、更新订单支付状态为已支付
		 XeVenOrderInfoEntity payOrder = new XeVenOrderInfoEntity();
		 payOrder.setUserCode(userCode);//商户编码
		 payOrder.setOrderId(orderId);//订单号
		 payOrder.setPayStatus(VenOrderPayStatusEnum.ALL_PAID.getValue());//更新为已支付
		 payOrder.setPayNumber(payNum);//支付单号
		 payOrder.setPayTime(date);//支付时间
		 payOrder.setOrderStatus(paramOrder.getOrderStatus());
		 payOrder.setOrderMark(paramOrder.getOrderMark());
		 if (secMark) {
				String orderMark = payOrder.getOrderMark();//订单标记
		    	if (orderMark != null ) {
		    		payOrder.setOrderMark(orderMark+","+VenOrderMarkEnum.SEC.getValue());//订单添加秒杀标识
				}else{
					payOrder.setOrderMark(VenOrderMarkEnum.SEC.getValue());//订单添加秒杀标识
				}
			}
			if (null != orderEntity.getCpnsPmtAomount() && orderEntity.getCpnsPmtAomount().compareTo(BigDecimal.ZERO)> 0) {
			    	String orderMark = payOrder.getOrderMark();//订单标记
			    	if (orderMark != null ) {
			    		payOrder.setOrderMark(orderMark+","+VenOrderMarkEnum.COUPON.getValue());//订单添加优惠券标识
					}else{
						payOrder.setOrderMark(VenOrderMarkEnum.COUPON.getValue());//订单添加优惠券标识
					}
			} 
		 payOrder.setOrderException(paramOrder.getOrderException());
		 payOrder.setPayChannel(paramOrder.getPayChannel());//支付渠道
		 upResult = xeVenOrderService.updateXeVenOrder(payOrder);//更新支付 商品明细信息是否缺货更新
		 log.info("待付款订单支付状态同步接口信息：订单号{},执行结果{}!",orderId,upResult);
		 return upResult;
	}
	
	
	/**
	 * 自动分仓接口
	 * @author: 李贝贝
	 * @createTime: 2017年8月16日 上午10:54:07  
	 * @history:  
	 * @param orderEntity
	 * @return
	 * @throws Exception int
	 */
	 private XeVenOrderInfoEntity autoSortWareHouse(XeVenOrderInfoEntity orderEntity) throws Exception{
		        //开始查询仓库
				//********自动分配仓库根据收货地区县级查询仓库，没有则根据市级查询仓库     LBB 2017-06-30 ADD Start*******//
				Map<String, Object> map = new HashMap<String, Object>();
				List<XeVenStoreInfoEntity> coverAreasList = null;
				map.put("areaId",orderEntity.getCaProvinceId());
				map.put("userCode",orderEntity.getUserCode());
				coverAreasList = this.xeVenStoreInfoReadMapper.queryUserStoreHouse(map);//查询覆盖区域方法
				if(coverAreasList == null || coverAreasList.size()==0){
					map = new HashMap<String, Object>();
					map.put("areaId",orderEntity.getCaCityId());
					map.put("userCode",orderEntity.getUserCode());
					coverAreasList = this.xeVenStoreInfoReadMapper.queryUserStoreHouse(map);
				}
				if(coverAreasList == null || coverAreasList.size()==0){
					map = new HashMap<String, Object>();
					map.put("areaId",orderEntity.getCaAreaId());
					map.put("userCode",orderEntity.getUserCode());
					coverAreasList = this.xeVenStoreInfoReadMapper.queryUserStoreHouse(map);
				}
				//查找到仓库则分仓，没有找到则置为异常订单，待分配
				if(coverAreasList != null && coverAreasList.size() >0 ){
					XeVenStoreInfoEntity storeInfoEntity = coverAreasList.get(0);
					XeVenOrderStoreEntity orderStore = new XeVenOrderStoreEntity();
					orderStore.setUserCode(orderEntity.getUserCode());
					orderStore.setStoreId(storeInfoEntity.getStoreId());
					orderStore.setOrderId(orderEntity.getOrderId());
					orderStore.setCreateUser("系统");
					orderStore.setCreateDate(new Date());
					int insertOStoreResut = xeVenOrderWriteMapper.insertXeVenOrderStore(orderStore);//插入订单仓库关系
					if (insertOStoreResut > 0) {
						//插入物流信息
						ErpUserInfo erpUserInfo = new ErpUserInfo();
						erpUserInfo.setUserCode(orderEntity.getUserCode());
						erpUserInfo.setLoginName(orderEntity.getCreaterUser());
						xeVenOrderService.insertOrderLogistics(erpUserInfo, orderEntity.getOrderId(), storeInfoEntity.getStoreName());
						//如果开启记录库存，则进行库存查询操作 ，否则则订单状态为待审核 ( 正常订单 )
						if (storeInfoEntity.getRecordInventoryFlag() == 1) {
							//允许负库存
							if (storeInfoEntity.getNegativeFlag() == 1) {
								//1、如果没有库存记录，则置为异常订单 
								//2、判断库存是否充足，充足则进行库存占用
								//3、如果库存不充足，直接置为异常订单
								XeVenStoreInventoryEntity invParam = null;
								int upInvResult = 0 ;//更新订单商品库存成功失败标识位
								List<XeVenOrderInfoDetailEntity> odetailList = orderEntity.getOrderInfoDetailList();
								for (int i = 0; i < odetailList.size(); i++) {
									invParam = new XeVenStoreInventoryEntity();//更新商品库存参数
									invParam.setStoreId(storeInfoEntity.getStoreId());
									invParam.setUserCode(orderEntity.getUserCode());
									invParam.setProSku(odetailList.get(i).getProSku());
									invParam.setLockedInv(odetailList.get(i).getPurchaseNum());
								    //  库存一览表    根据userCode proSku  storeId 更新 订单占用数 
									int updateResult = xeVenStoreInventoryService.updateStoreInvByStoreInventoryEntity(invParam,null);
									if (updateResult == 0) {
										odetailList.get(i).setInventoryFlag(2);//此商品库存不足 需要补货
									}
									upInvResult += updateResult;//订单商品更新结果 如果更新结果等于更新商品数 则为正常订单 否则为异常订单
								}
								if (upInvResult != odetailList.size()) {
									orderEntity.setOrderMark(VenOrderMarkEnum.EXCEPTIONORDER.getValue());//订单标注
									orderEntity.setOrderException(VenOrderExpFlagEnum.PROBLEM.getValue());//置为异常订单
									orderEntity.setOrderStatus(VenOrderStatusEnum.WAIT_CHECK.getValue());//订单状态置为待审核
								}else{//正常订单为待审核状态
									orderEntity.setOrderException(VenOrderExpFlagEnum.NO_PROBLEM.getValue());//置为正常订单 没有异常
									orderEntity.setOrderStatus(VenOrderStatusEnum.WAIT_CHECK.getValue());//订单状态置为待审核
								}
							}else {
								//1、如果没有库存记录，则置为异常订单 
								//2、判断库存是否充足，充足则进行库存占用
								//3、如果库存不充足，直接置为异常订单
								XeVenStoreInventoryEntity invParam = null;
								int upInvResult = 0 ;//更新订单商品库存成功失败标识位
								List<XeVenOrderInfoDetailEntity> odetailList = orderEntity.getOrderInfoDetailList();
								for (int i = 0; i < odetailList.size(); i++) {
									invParam = new XeVenStoreInventoryEntity();//更新商品库存参数
									invParam.setStoreId(storeInfoEntity.getStoreId());
									invParam.setUserCode(orderEntity.getUserCode());
									invParam.setProSku(odetailList.get(i).getProSku());
									invParam.setLockedInv(odetailList.get(i).getPurchaseNum());
								    //  库存一览表    根据userCode proSku  storeId 更新 订单占用数 
									int updateResult = xeVenStoreInventoryService.updateStoreInvByStoreInventoryEntity(invParam,odetailList.get(i).getPurchaseNum());
									if (updateResult == 0) {
										odetailList.get(i).setInventoryFlag(2);//此商品库存不足 需要补货
									}
									upInvResult += updateResult;//订单商品更新结果 如果更新结果等于更新商品数 则为正常订单 否则为异常订单
								}
								if (upInvResult != odetailList.size()) {
									orderEntity.setOrderMark(VenOrderMarkEnum.EXCEPTIONORDER.getValue());//订单标注
									orderEntity.setOrderException(VenOrderExpFlagEnum.PROBLEM.getValue());//置为异常订单
									orderEntity.setOrderStatus(VenOrderStatusEnum.WAIT_CHECK.getValue());//订单状态置为待审核
								}else{//正常订单为待审核状态
									orderEntity.setOrderException(VenOrderExpFlagEnum.NO_PROBLEM.getValue());//置为正常订单 没有异常
									orderEntity.setOrderStatus(VenOrderStatusEnum.WAIT_CHECK.getValue());//订单状态置为待审核
								}
							}
						}else {//没有开启库存记录 为正常待审核订单
							orderEntity.setOrderException(VenOrderExpFlagEnum.NO_PROBLEM.getValue());//置为正常订单 没有异常
							orderEntity.setOrderStatus(VenOrderStatusEnum.WAIT_CHECK.getValue());//订单状态置为待审核
						}
					}else{//插入订单仓库失败
						orderEntity.setOrderMark(VenOrderMarkEnum.EXCEPTIONORDER.getValue());//订单标注
						orderEntity.setOrderException(VenOrderExpFlagEnum.PROBLEM.getValue());//置为异常订单
						orderEntity.setOrderStatus(VenOrderStatusEnum.WAIT_DIS.getValue());//订单状态置为待分配
					}
				}else {//没有找到对应仓库
					orderEntity.setOrderMark(VenOrderMarkEnum.EXCEPTIONORDER.getValue());//订单标注
					orderEntity.setOrderException(VenOrderExpFlagEnum.PROBLEM.getValue());//置为异常订单
					orderEntity.setOrderStatus(VenOrderStatusEnum.WAIT_DIS.getValue());//订单状态置为待分配
					List<XeVenOrderInfoDetailEntity> odetailList = orderEntity.getOrderInfoDetailList();
					for (XeVenOrderInfoDetailEntity detail : odetailList) {
						detail.setInventoryFlag(2);//分仓失败，商品明细置为库存不足
					}
				}
		log.info("自动分仓接口返回订单信息为:{}",JSONObject.toJSONString(orderEntity));
		return orderEntity;
	}
	
	/**
	 * 待付款订单支付状态同步接口使用 
	 * @author: 李贝贝
	 * @createTime: 2017年8月16日 上午11:41:16  
	 * @history:  
	 * @param resultMap
	 * @return XeVenOrderInfoEntity
	 */
	public XeVenOrderInfoEntity getWaitPayOrder(Map<String, Object> resultMap){
		XeVenOrderInfoEntity xOrderInfoEntity = xeVenOrderReadMapper.getWaitPayOrder(resultMap);
		if (null != xOrderInfoEntity && StringUtils.isNotBlank(xOrderInfoEntity.getOrderId())) {
			Map<String, Object> detailMap = new HashMap<String, Object>();
			detailMap.put("orderId", xOrderInfoEntity.getOrderId());//订单号
			detailMap.put("userCode", xOrderInfoEntity.getUserCode());//商户编码
			xOrderInfoEntity.setOrderInfoDetailList(xeVenOrderReadMapper.getOrderDetailByParam(detailMap));// 查询订单明细信息
			return xOrderInfoEntity;
		}else{
			return null;
		}
		
	}

	/**
	 * 查询各种订单备注
	 * @author: 李书峰
	 * @createTime: 2017年8月17日 下午5:33:47
	 * @history:
	 * @param resultMap
	 * @return XeVenOrderInfoEntity
	*/
	@Override
	public XeVenOrderInfoEntity queryRemarks(Map<String, Object> resultMap){
		return xeVenOrderReadMapper.queryRemarks(resultMap);
	}
	
	/**
	 * 统计订单是否存在同步订单使用
	 * @author: 李贝贝
	 * @createTime: 2017年11月15日 下午6:12:58  
	 * @history:  
	 * @param orderList
	 * @return BigDecimal
	 */
	public BigDecimal countOrderExists(List<String> orderList){
		return xeVenOrderWriteMapper.countOrderExists(orderList);
	}
	/**
	 *  货到付款订单完成支付时，需要更新订单支付状态为已支付
	 * @author: 李贝贝
	 * @createTime: 2017年8月16日 上午11:06:52  
	 * @history:  
	 * @param orderEntity
	 * @return
	 * @throws Exception int
	 */
	public int podSyncOrderStatus(XeVenOrderInfoEntity orderEntity) throws Exception {
		int upResult = xeVenOrderService.updateXeVenOrder(orderEntity);//更新支付 商品明细信息是否缺货更新
		log.info("货到付款订单完成支付时，需要更新订单支付状态为已支付:{}",upResult);
		return upResult;
	}
}
  
